package com.origon.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.UUID;
import java.math.BigDecimal;


/**
 * The persistent class for the sale database table.
 * 
 */
@Entity
public class Sale implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String id;

	private String salesNumber;

	private BigDecimal salesPrice;

	private Timestamp soldDate;

	//bi-directional many-to-one association to Product
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="id")
	private Product product;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="BuyerId")
	private User user;

	public Sale() {
		setId(UUID.randomUUID().toString());
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSalesNumber() {
		return this.salesNumber;
	}

	public void setSalesNumber(String salesNumber) {
		this.salesNumber = salesNumber;
	}

	public BigDecimal getSalesPrice() {
		return this.salesPrice;
	}

	public void setSalesPrice(BigDecimal salesPrice) {
		this.salesPrice = salesPrice;
	}

	public Timestamp getSoldDate() {
		return this.soldDate;
	}

	public void setSoldDate(Timestamp soldDate) {
		this.soldDate = soldDate;
	}

	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}